package com.example.myapplication;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class UserInfoFragment extends Fragment {
  String userAccount;
  String userName;
  TextView accountText;
  TextView nameText;
  View view;


  @Override public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
      userAccount = getArguments().getString("userAccount");
      userName = getArguments().getString("userName");
    }
  }

  @Nullable @Override
  public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
      @Nullable Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.user_info_fragment_layout, container, false);
    return view;
  }

  @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    InitInfo();
  }

  private void InitInfo() {
    accountText = view.findViewById(R.id.user_account);
    nameText = view.findViewById(R.id.user_name);
    accountText.setText(userAccount);
    nameText.setText(userName);

  }
}
